package at.jaki.ubb.crawling.api;

import at.jaki.ubb.crawling.model.EngineStatus;
import at.jaki.ubb.crawling.model.Target;
import at.jaki.ubb.crawling.model.config.CrawlingEngineConfig;

/**
 * This interface specifies the external API of the Crawling engine data minder.
 * 
 * @author Jakabfi Attila
 */
public interface CrawlingEngine {

	/**
	 * method to start the engine.
	 * 
	 * @param xml configuration xml
	 */
	void start(String xml);

	/**
	 * method to start the engine
	 * 
	 * @param config {@link CrawlingEngineConfig} instance.
	 */
	void start(CrawlingEngineConfig config);

	/**
	 * Will start the engine with the last configuration used
	 */
	void startWithLastConfig() throws IllegalStateException;

	/**
	 * Method to add a target element manually
	 * 
	 * @param xml target specified as xml
	 */
	void addTarget(String xml);

	/**
	 * Method to add a target element manually
	 * 
	 * @param t target Object
	 */
	void addTarget(Target<?> t);

	/**
	 * method to stop the engine. Will shot down all threads.
	 */
	void stop();

	/**
	 * Will return the current status of the engine
	 * 
	 * @return a bean containing the status data
	 */
	EngineStatus getStatus();

	/**
	 * @return true if the Crawling engine is stopped. (no threads are running)
	 */
	boolean isStopped();

}
